import Vue from 'vue'
import VueRouter from 'vue-router'
import Welcome from '../views/Welcome.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Welcome',
    component: Welcome
  },
  {
    path: '/electric_form',
    name: 'ElectricForm',
    component: () => import('../views/ElectricForm.vue')
  },
  {
    path: '/es_charts',
    name: 'ESCharts',
    component: () => import('../views/ESCharts.vue')
  },
  {
    path: '/es_record/:id/:key',
    name: 'Admin',
    component: () => import('../views/Admin.vue')
  }
]

const scrollBehavior = (to, from, savedPosition) => {
  return { x: 0, y: 0 }
}

const router = new VueRouter({
  routes,
  scrollBehavior
})

export default router
